/*
 * Copyright (c) 2015 sb Jung.
 * All right reserved.
 */
package kr.co.j2b.api.sample.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import kr.co.j2b.api.sample.service.SampleService;
import kr.co.j2b.common.model.ResultResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
 * <pre>
 * kr.co.j2b.api.sample.controller 
 *    |_ SampleController.java
 * </pre>
 * @date : 2015. 4. 7. 오후 1:38:13
 * @author : J-PC
 */
@RequestMapping(value = "/sample")
@Controller
public class SampleController {
	
	
	@Autowired(required=true)
	private SampleService sampleService;
	
	@RequestMapping(value = "/get/{seq}", method = RequestMethod.GET, produces="application/json")
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResultResponse getList(HttpServletRequest request) throws Exception {
		return sampleService.getList();
		
	}
	
	@RequestMapping(value = "/countries", method = RequestMethod.GET, produces="application/json")
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public List<Map<String, Object>> getCountries() {		
		return sampleService.getCountries();
	}
	
	@RequestMapping(value = "/countries/{id}", method = RequestMethod.GET, produces="application/json")
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public Map<String, Object> getCountriesDetail(@PathVariable("id") String id) {
		return sampleService.getCountriesDetail(id);
	}
	
}
